// mmo_game_server/battle/lua_battle_bindings.cpp
#include "lua_battle_bindings.h"
#include "battle/skill_system.h"

// 假设的Entity和SkillParams定义
class Entity {};
struct SkillParams {};

namespace battle {
    static int lua_use_skill(lua_State* L) {
        SkillSystem* skillSystem = static_cast<SkillSystem*>(lua_touserdata(L, lua_upvalueindex(1)));
        Entity* caster = nullptr; // 这里需要正确获取施法者实体
        Entity* target = nullptr; // 这里需要正确获取目标实体
        int skill_id = luaL_checkinteger(L, 1);
        SkillParams params; // 这里需要正确初始化参数
        bool result = skillSystem->use_skill(caster, target, skill_id, params);
        lua_pushboolean(L, result);
        return 1;
    }
}

void RegisterLuaBattleBindings(lua_State* L, battle::SkillSystem* skillSystem) {
    lua_pushlightuserdata(L, skillSystem);
    lua_pushcclosure(L, battle::lua_use_skill, 1);
    lua_setglobal(L, "use_skill");
}